package com.example.zg6.splash;

import com.example.common.filed.DataActionEntity;
import com.example.common.mvvm.viewmodel.BaseViewModel;
import com.example.network_skd.BaseEntity;

import java.util.HashMap;
import java.util.Map;

public class SplashViewModel extends BaseViewModel<SplashRepository> {
    @Override
    protected void initData() {
        new Thread(){
            @Override
            public void run() {
                super.run();
                for (int i =3;i >=0;i--){
                    try {
                        Thread.sleep(1000);
                    } catch (InterruptedException e) {
                        e.printStackTrace();
                    }
                    DataActionEntity dataActionEntity = new DataActionEntity();
                    dataActionEntity.action = "DOWNTIME";
                    Map<String , Object> map = new HashMap<>();

                    map.put("time", ""+i+"s");

                    dataActionEntity.data =map;
                    vmData.post(dataActionEntity);
                }
            }
        }.start();
    }

    @Override
    protected void onResult(BaseEntity baseEntity) {

    }
}
